home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD-ROM Interactive 4
/
CD-Rom Interactive (magazine) coverdisc (Disc 4, January, 1995).iso
/
pc
/
qt
/
setup.mst
< prev
next >
Wrap
Text File
|
1994-07-18
|
18KB
|
501 lines
rem ---------------------------------------------------------------------
rem
rem SETUP.MST - MSSETUP Installation Script
rem
rem Version 1.0
rem
rem (c) 1988-1992 Apple Computer, Inc. All Rights Reserved.
rem
rem ---------------------------------------------------------------------
rem ---------------------------------------------------------------------
rem
rem Adapted slightly for the DK Sampler Disc setup, to avoid (c) infringement
rem and to avoid supporting things DK doesn't support (e.g. French).
rem
rem ---------------------------------------------------------------------
rem Required includes to interface with MSSETUP DLL's
rem -------------------------------------------------
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
rem Dialog box id's
rem ---------------
rem Note: If MSSETUP were really smart, we could use the
rem #defines in DIALOGS.HR. Instead, we must manually
rem keep them in step
rem ----------------------------------------------------
CONST DESTPATH = 300 ''Gets destination path
CONST EXITQUIT = 600 ''Exits on user request
CONST EXITSUCCESS = 700 ''Exits when install is done
CONST OPTIONS = 800 ''Gets AUTOEXEC.BAT options
CONST ASKSETUP = 1100 ''Gets installation type (Local etc)
CONST TOOBIG = 6300 ''Not enough space on target disk error
CONST BADPATH = 6400 ''Bad destination path error
CONST BADWINDOWS = 6500 ''Wrong Windows release
CONST EXITFAILURE = 6600 ''Exits on error
rem String id's
rem -----------
rem Note: If MSSETUP were really smart, we could use the
rem #defines in DIALOGS.HR. Instead, we must manually
rem keep them in step
rem ----------------------------------------------------
CONST STR_PLAYER = 1024 ''Movie Player
CONST STR_VIEWER = 1025 ''Picture Viewer
CONST STR_GROUP = 1026 ''Program Manager group
CONST STR_TITLE = 1027 ''Installer Title
CONST STR_MSG1 = 1028 ''Version error message part 1
CONST STR_MSG2 = 1029 ''Version error message part 2
CONST STR_MSG3 = 1030 ''Remove obsolete files?
CONST STR_WARNING = 1031 ''Warning
CONST STR_HELP = 1032 ''Help
rem Miscellaneous Constants
rem -----------------------
CONST NOLOGO = 1 ''Dummy NULL bitmap (must be 1)
CONST LOGO = 2 ''Background bitmap
CONST MOVIE = 2 ''Movie placeholder bitmap
CONST NOSPACE = 1 ''No space to complete install
CONST INSTALLOK = 2 ''Install completed OK
CONST INSTALLFAILED =3 ''Install failed for some reason
rem Global Variables
rem ----------------
GLOBAL SOURCE$ ''Source directory
GLOBAL DEST$ ''Default destination directory
GLOBAL SETUPTYPE$ ''Setup type (Local, Client, Server)
GLOBAL LOCALINST$ ''Local install
GLOBAL CLIENTINST$ ''Client install
GLOBAL SERVERINST$ ''Server install
GLOBAL MODAUTOEXECOPT$ ''Modify AUTOEXEC.BAT option
GLOBAL MODAUTOEXEC$ ''Modify AUTOEXEC.BAT
GLOBAL COPYAUTOEXEC$ ''Copy AUTOEXEC.BAT and modify it
GLOBAL CUIDLL$ ''User interface DLL
GLOBAL SETUPPATH$ ''Setup destination path
GLOBAL HELPPROC$ ''Help dialog procedure
GLOBAL EXTRACOSTS$ ''List of extra costs to add per drive
GLOBAL APPNEEDS$ ''Disk space costs per drive
GLOBAL SECTIONKEY$ ''INF file section key
GLOBAL SUCCESS% ''Installation completion code
rem Initialize global vriables
rem --------------------------
LOCALINST$ = "1"
CLIENTINST$ = "2"
SERVERINST$ = "3"
MODAUTOEXEC$ = "1"
COPYAUTOEXEC$ = "2"
SETUPPATH$ = "C:\QTW"
SETUPTYPE$ = LOCALINST$
SOURCE$ = GetSymbolValue("STF_SRCDIR")
DEST$ = SETUPPATH$
MODAUTOEXECOPT$ = MODAUTOEXEC$
SUCCESS% = INSTALLFAILED
EXTRACOSTS$ = "ExtraCosts"
APPNEEDS$ = "AppNeeds"
SECTIONKEY$ = "SectionKey"
FOR i% = 1 TO 26 STEP 1
AddListItem EXTRACOSTS$, "16384"
NEXT i%
rem Get name of localized user interface dialogs
rem --------------------------------------------
rem CUIDLL$ = "SETUP"+GetIniKeyString("WIN.INI", "intl", "sLanguage")+".DLL"
rem IF DoesFileExist(CUIDLL$, femExists) = 0 THEN
CUIDLL$ = "SETUPENU.DLL"
rem END IF
rem Subroutines and Functions
rem -------------------------
DECLARE FUNCTION Install AS INTEGER
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
DECLARE FUNCTION GetQTWVersion LIB "setupenu.dll" (szDLL$) AS INTEGER
DECLARE FUNCTION GetResourceString LIB "setupenu.dll" (szResource$, idString%) AS INTEGER
DECLARE FUNCTION StartCustomSetup LIB "setupenu.dll" (hinst%, hwnd%) AS INTEGER
DECLARE FUNCTION StopCustomSetup LIB "setupenu.dll" (hinst%, hwnd%) AS INTEGER
DECLARE FUNCTION UpdateAutoExecBat LIB "setupenu.dll" (szIn$, szOut$, szDest$) AS INTEGER
DECLARE FUNCTION WritePrivateProfileString LIB "krnl386.exe" (szSect$, szEntry$, szString$, szINI$) AS INTEGER
rem Initialize custom setup logic
rem -----------------------------
SetBitmap CUIDLL$, NOLOGO
i% = GetResourceString (CUIDLL$, STR_TITLE)
SetTitle GetSymbolValue ("ResourceString")
i% = StartCustomSetup (HinstFrame(), HwndFrame ())
i% = SetBeepingMode(1)
rem Make sure that we are running on Windows 3.1 or better
rem ------------------------------------------------------
IF GetWindowsMajorVersion() < 3 THEN
sz$ = UIStartDlg(CUIDLL$, BADWINDOWS, "FInfo0DlgProc", 0, "")
UIPop 1
GOTO CLEANUP
END IF
IF (GetWindowsMajorVersion() = 3) AND (GetWindowsMinorVersion() < 10) THEN
sz$ = UIStartDlg(CUIDLL$, BADWINDOWS, "FInfo0DlgProc", 0, "")
UIPop 1
GOTO CLEANUP
END IF
rem Make sure that we are running on a 286 or better
rem ------------------------------------------------
IF GetWinFlags() AND 2 THEN
sz$ = UIStartDlg(CUIDLL$, BADWINDOWS, "FInfo0DlgProc", 0, "")
UIPop 1
GOTO CLEANUP
END IF
rem Find and read the .INF file. We'll use DISKETTE.INF when installing
rem from drive A: or B:, CD.INF otherwise.
rem -------------------------------------------------------------------
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szTemp$ = GetSymbolValue("STF_SRCDIR")
SPLITPATH szTemp$, drv$, dir$, filename$, ext$
rem IF (drv$ = "A:") OR (drv$ = "B:") THEN
rem szInf$ = szTemp$ + "DISKETTE.INF"
rem ELSE
szInf$ = szTemp$ + "CD.INF"
END IF
ReadInfFile szInf$
rem Get the setup type: Local, Client or Server
rem -------------------------------------------
ITYPE:
SetSymbolValue "RadioDefault", SETUPTYPE$
ITYPEL1:
sz$ = UIStartDlg(CUIDLL$, ASKSETUP, "FRadioDlgProc", 0, "")
SETUPTYPE$ = GetSymbolValue("ButtonChecked")
IF sz$ = "CONTINUE" THEN
UIPop(1)
ELSEIF sz$ = "REACTIVATE" THEN
GOTO ITYPEL1
ELSE
GOSUB ASKQUIT
GOTO ITYPE
END IF
rem Get the AUTOEXEC.BAT modification option
rem ----------------------------------------
OPTIONC:
IF SETUPTYPE$ = SERVERINST$ THEN
GOTO GETPATH
END IF
SetSymbolValue "RadioDefault", MODAUTOEXECOPT$
OPTL1:
sz$ = UIStartDlg(CUIDLL$, OPTIONS, "FRadioDlgProc", 0, "")
MODAUTOEXECOPT$ = GetSymbolValue("ButtonChecked")
IF sz$ = "CONTINUE" THEN
UIPop(1)
ELSEIF sz$ = "REACTIVATE" THEN
GOTO OPTL1
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO ITYPE
ELSE
GOSUB ASKQUIT
GOTO OPTIONC
END IF
rem Get the destination path; if it's bad, we display an error
rem ----------------------------------------------------------------
GETPATH:
IF SETUPTYPE$ = CLIENTINST$ THEN
DEST$ = SOURCE$
GOTO INSTALL
END IF
SetSymbolValue "EditTextIn", DEST$
SetSymbolValue "EditFocus", "END"
GETPATHL1:
sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", 0, "")
DEST$ = GetSymbolValue("EditTextOut")
IF sz$ = "CONTINUE" THEN
IF IsDirWritable(DEST$) = 0 THEN
GOSUB BADPATH
GOTO GETPATHL1
END IF
IF DoesFileExist(MakePath(DEST$, "bin\qtim.dll"), femExists) = 1 THEN
szError$ = MakePath(DEST$, "BIN")
i% = GetResourceString (CUIDLL$, STR_MSG1)
szError$ = szError$ + GetSymbolValue ("ResourceString")
i% = GetQTWVersion(MakePath(DEST$, "bin\qtim.dll"))
szVersion$ = GetSymbolValue ("VersionString")
szError$ = szError$ + szVersion$
i% = GetResourceString (CUIDLL$, STR_MSG2)
szError$ = szError$ + GetSymbolValue ("ResourceString")
i% = GetResourceString (CUIDLL$, STR_WARNING)
szCaption$ = GetSymbolValue ("ResourceString")
i% = DoMsgBox(szError$, szCaption$, 20)
UIPop 1
IF i% = 7 THEN
GOTO GETPATHL1
END IF
IF szVersion$ = "1.0.0" THEN
i% = GetResourceString (CUIDLL$, STR_MSG3)
szError$ = GetSymbolValue ("ResourceString")
i% = GetResourceString (CUIDLL$, STR_WARNING)
szCaption$ = GetSymbolValue ("ResourceString")
i% = DoMsgBox(szError$, szCaption$, 20)
IF i% = 6 THEN
RemoveFile MakePath(DEST$, "bin\qcmc.dll"), cmoForce
RemoveFile MakePath(DEST$, "bin\qtjpeg.dll"), cmoForce
RemoveFile MakePath(DEST$, "bin\qtraw.dll"), cmoForce
RemoveFile MakePath(DEST$, "bin\qtsmc.dll"), cmoForce
RemoveFile MakePath(DEST$, "bin\qtrpza.dll"), cmoForce
RemoveFile MakePath(DEST$, "bin\qtrle.dll"), cmoForce
RemoveFile MakePath(DEST$, "bin\qtcvid.dll"), cmoForce
RemoveFile MakePath(DEST$, "bin\qtrt21.dll"), cmoForce
END IF
END IF
END IF
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETPATHL1
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO OPTIONC
ELSE
GOSUB ASKQUIT
GOTO GETPATH
END IF
rem Perform actual installation
rem ---------------------------
INSTALL:
SUCCESS% = Install
IF SUCCESS% = NOSPACE THEN
GOSUB TOOBIG
GOTO GETPATH
END IF
rem When done, issue dialog
rem -----------------------
QUIT:
IF SUCCESS% = INSTALLOK THEN
sz$ = UIStartDlg(CUIDLL$, EXITSUCCESS, "FInfo0DlgProc", 0, "")
ELSE
sz$ = UIStartDlg(CUIDLL$, EXITFAILURE, "FInfo0DlgProc", 0, "")
END IF
UIPop 1
rem Clean up all processing
rem -----------------------
CLEANUP:
i% = StopCustomSetup (HinstFrame(), HwndFrame ())
END
rem ASKQUIT: The user requested quit; does (s)he really want to?
rem ------------------------------------------------------------
ASKQUIT:
sz$ = UIStartDlg(CUIDLL$, EXITQUIT, "FInfoDlgProc", 0, "")
UIPop 1
IF sz$ = "CONTINUE" THEN
RETURN
END IF
GOTO CLEANUP
rem BADPATH: The user entered an invalid destination directory
rem ----------------------------------------------------------
BADPATH:
sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BADPATH
END IF
UIPop 1
RETURN
rem TOOBIG: The source files won't fit on the requested destination disk
rem --------------------------------------------------------------------
TOOBIG:
sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO TOOBIG
END IF
UIPop 1
RETURN
rem Install: Perform actual installation
rem ------------------------------------
FUNCTION Install STATIC AS INTEGER
rem For Local or Server installs ...
rem --------------------------------
IF (SETUPTYPE$ = LOCALINST$) OR (SETUPTYPE$ = SERVERINST$) THEN
rem Create the destination directory
rem --------------------------------
CreateDir DEST$, cmoNone
rem Build the copy list
rem -------------------
AddSectionFilesToCopyList "Files", SOURCE$, DEST$
IF SETUPTYPE$ = SERVERINST$ THEN
AddSectionFilesToCopyList "Setup", SOURCE$, DEST$
END IF
rem Check that we have enough free space to perform the install
rem -----------------------------------------------------------
ListSym$ = APPNEEDS$
StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
drive$ = MID$(DEST$, 1, 1)
ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
cost& = VAL(GetListItem(APPNEEDS$, ndrive%))
free& = GetFreeSpaceForDrive(drive$)
IF cost& >= free& THEN
Install = NOSPACE
EXIT FUNCTION
END IF
rem Copy files necessary for installation from server
rem -------------------------------------------------
rem IF SETUPTYPE$ = SERVERINST$ THEN
rem CopyFile MakePath(SOURCE$, "CD.INF"), MakePath(DEST$, "CD.INF"), cmoOverwrite, 0
rem CopyFile MakePath(SOURCE$, "DISKETTE.INF"), MakePath(DEST$, "DISKETTE.INF"), cmoOverwrite, 0
rem CopyFile MakePath(SOURCE$, "DISK1.ID"), MakePath(DEST$, "DISK1.ID"), cmoOverwrite, 0
rem END IF
rem Copy all the files from the source to the destination
rem -----------------------------------------------------
CopyFilesInCopyList
END IF
rem Update AUTOEXEC.BAT
rem -------------------
IF (SETUPTYPE$ = LOCALINST$) OR (SETUPTYPE$ = CLIENTINST$) THEN
i% = UpdateAutoExecBat("C:\AUTOEXEC.BAT", "C:\AUTOEXEC.QTW", DEST$)
IF MODAUTOEXECOPT$ = MODAUTOEXEC$ THEN
CopyFile "C:\AUTOEXEC.BAT", "C:\AUTOEXEC.BAK", cmoOverwrite, 0
CopyFile "C:\AUTOEXEC.QTW", "C:\AUTOEXEC.BAT", cmoOverwrite, 0
RemoveFile "C:\AUTOEXEC.QTW", cmoForce
END IF
END IF
rem Update WIN.INI and SYSTEM.INI
rem -----------------------------
IF (SETUPTYPE$ = LOCALINST$) OR (SETUPTYPE$ = CLIENTINST$) THEN
CreateIniKeyValue "WIN.INI", "Extensions", "mov", MakePath(DEST$,"bin\player.exe") + " ^.mov", cmoNone
CreateIniKeyValue "WIN.INI", "Extensions", "pic", MakePath(DEST$,"bin\viewer.exe") + " ^.pic", cmoNone
CreateIniKeyValue "WIN.INI", "MCI Extensions", "mov", "QTWVideo", cmoNone
CreateIniKeyValue "WIN.INI", "MCI Extensions", "pic", "QTWVideo", cmoNone
CreateIniKeyValue "WIN.INI", "MCI Extensions", "jpg", "QTWVideo", cmoNone
i% = WritePrivateProfileString("MCI", "QTWVideo", MakePath(DEST$, "bin\mciqtw.drv"), "SYSTEM.INI")
END IF
rem Update Registration Database
rem ----------------------------
IF (SETUPTYPE$ = LOCALINST$) OR (SETUPTYPE$ = CLIENTINST$) THEN
RUN MakePath(DEST$, "bin\player.exe") + " install"
RUN MakePath(DEST$, "bin\viewer.exe") + " install"
END IF
rem Create QTW.INI
rem ----------------
IF (SETUPTYPE$ = LOCALINST$) OR (SETUPTYPE$ = CLIENTINST$) THEN
ini$ = MakePath(GetWindowsDir(), "QTW.INI")
CreateIniKeyValue ini$, "QuickTime for Windows", "Implementation", "Full" , cmoNone
END IF
rem Create a Program Manager group
rem ------------------------------
rem Not sure we've got the rights...
rem IF (SETUPTYPE$ = LOCALINST$) OR (SETUPTYPE$ = CLIENTINST$) THEN
rem i% = GetResourceString (CUIDLL$, STR_GROUP)
rem GROUP$ = GetSymbolValue ("ResourceString")
rem CreateProgmanGroup GROUP$, "", cmoNone
rem i% = GetResourceString (CUIDLL$, STR_PLAYER)
rem CreateProgmanItem GROUP$, GetSymbolValue ("ResourceString"), MakePath(DEST$,"bin\player.exe"), "", cmoOverwrite
rem i% = GetResourceString (CUIDLL$, STR_VIEWER)
rem CreateProgmanItem GROUP$, GetSymbolValue ("ResourceString"), MakePath(DEST$,"bin\viewer.exe"), "", cmoOverwrite
rem i% = GetResourceString (CUIDLL$, STR_HELP)
rem CreateProgmanItem GROUP$, GetSymbolValue ("ResourceString"), "WinHelp " + MakePath(DEST$,"help\qtw.hlp"), ",,,," + DEST$, cmoOverwrite
rem CreateProgmanItem GROUP$, "Read Me", "write " + MakePath(DEST$,"readme.wri"), ",,,," + DEST$, cmoOverwrite
rem END IF
rem Indicate install completed OK
rem -----------------------------
Install = INSTALLOK
END FUNCTION
rem MakePath: Builds path from directory and file
rem ---------------------------------------------
FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
IF szDir$ = "" THEN
MakePath = szFile$
ELSEIF szFile$ = "" THEN
MakePath = szDir$
ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
MakePath = szDir$ + szFile$
ELSE
MakePath = szDir$ + "\" + szFile$
END IF
END FUNCTION